package cn.jantd.modules.system.mapper;

import cn.jantd.modules.system.entity.SysRoleTeamuser;
import cn.jantd.modules.system.entity.SysTeamUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 团队角色表 Mapper 接口
 * </p>
 *
 * @Author xiagf
 * @date 2019-07-04
 */
public interface SysTeamUserMapper extends BaseMapper<SysTeamUser> {

    /**
     * 通过团队名称查询角色信息
     *
     * @param teamName
     * @return
     */
    @Select("select username from sys_user where id in (select user_id from sys_team_user where team_id = (select id from sys_team where team_name=#{teamName}))")
    List<String> getUserByTeamName(@Param("teamName") String teamName);

    /**
     * 通过teamId查询用户部门信息
     * @param teamId
     * @return
     */
    List<SysTeamUser> getByTeamId(@io.lettuce.core.dynamic.annotation.Param("teamId") String teamId);
}
